﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using TarreOA.TarreOAModels;
using TarreOA.TarreOADAL;

namespace TarreOA.TarreOABLL
{
    public class PublicCommunicationGroupLinkManService
    {
        /// <summary>
        /// 为指定通讯组添加联系人
        /// </summary>
        /// <param name="comGroupId"></param>
        /// <param name="groupLinkManName"></param>
        /// <param name="groupLinkManSec"></param>
        /// <param name="groupLinkManBirthday"></param>
        /// <param name="groupLinkManName2"></param>
        /// <param name="groupLinkManDurty"></param>
        /// <param name="groupLinkManUnitName"></param>
        /// <param name="groupLinkManUnitAddress"></param>
        /// <param name="groupLinkManUnitTelephone"></param>
        /// <param name="groupLinkManUnitFacsimile"></param>
        /// <param name="groupLinkManHomeAddress"></param>
        /// <param name="groupLinkManHomeTelephone"></param>
        /// <param name="groupLinkManHandset"></param>
        /// <param name="groupLinkManEmail"></param>
        /// <param name="groupLinkManOicq"></param>
        /// <param name="groupLinkManMsn"></param>
        /// <param name="groupLinkManRemark"></param>
        /// <returns></returns>
        public int saveComGroupLinkManInfo(int comGroupId, string groupLinkManName, int groupLinkManSec, DateTime groupLinkManBirthday
            , string groupLinkManName2, string groupLinkManDurty, string groupLinkManUnitName, string groupLinkManUnitAddress
            , string groupLinkManUnitTelephone, string groupLinkManUnitFacsimile, string groupLinkManHomeAddress
            , string groupLinkManHomeTelephone, string groupLinkManHandset, string groupLinkManEmail, string groupLinkManOicq
            , string groupLinkManMsn, string groupLinkManRemark)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.saveComGroupLinkManInfo(comGroupId, groupLinkManName, groupLinkManSec, groupLinkManBirthday, groupLinkManName2,
                groupLinkManDurty, groupLinkManUnitName, groupLinkManUnitAddress, groupLinkManUnitTelephone, groupLinkManUnitFacsimile,
                groupLinkManHomeAddress, groupLinkManHomeTelephone, groupLinkManHandset, groupLinkManEmail, groupLinkManOicq,
                groupLinkManMsn, groupLinkManRemark);
        }

        
        /// <summary>
        /// 根据通讯组编号查找该通讯组的联系人信息
        /// </summary>
        /// <param name="cgid"></param>
        /// <returns></returns>
        public List<PublicCommunicationGroupLinkMantb> findByComGroupId(int cgid)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.findByComGroupId(cgid);
        }

        /// <summary>
        ///  根据通讯人编号查找通讯人信息
        /// </summary>
        /// <param name="cglmId"></param>
        /// <returns></returns>
        public PublicCommunicationGroupLinkMantb findByCglmId(int cglmId)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.findByCglmId(cglmId);
        }

         /// <summary>
        /// 根据通讯人编号删除通讯人信息
        /// </summary>
        /// <param name="pcglmId"></param>
        /// <returns></returns>
        public int delByPcglmid(int pcglmId)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.delByPcglmid(pcglmId);
        }

        /// <summary>
        /// 根据通讯组联系人编号更改联系人信息
        /// </summary>
        /// <param name="cgLmid"></param>
        /// <param name="cgid"></param>
        /// <param name="cgLmName"></param>
        /// <param name="cgLmSec"></param>
        /// <param name="cgLmBirthday"></param>
        /// <param name="cgLmName2"></param>
        /// <param name="cgLmDuty"></param>
        /// <param name="cgLmUnitName"></param>
        /// <param name="cgLmUnitAddress"></param>
        /// <param name="cgLmUnitTelephone"></param>
        /// <param name="cgLmUnitFacsimile"></param>
        /// <param name="cgLmHomeAddress"></param>
        /// <param name="cgLmHomeTelephone"></param>
        /// <param name="cgLmHandset"></param>
        /// <param name="cgLmEmail"></param>
        /// <param name="cgLmOicq"></param>
        /// <param name="cgLmMsn"></param>
        /// <param name="cgLmRemark"></param>
        /// <returns></returns>
        public int updateComGroupLinkManInfoByGroupLinkManId(int cgLmid, int cgid, string cgLmName, int cgLmSec, DateTime cgLmBirthday,
            string cgLmName2, string cgLmDuty, string cgLmUnitName, string cgLmUnitAddress, string cgLmUnitTelephone,
            string cgLmUnitFacsimile, string cgLmHomeAddress, string cgLmHomeTelephone, string cgLmHandset, string cgLmEmail,
            string cgLmOicq, string cgLmMsn, string cgLmRemark)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.updateComGroupLinkManInfoByGroupLinkManId(cgLmid, cgid, cgLmName, cgLmSec, cgLmBirthday, cgLmName2,
                cgLmDuty, cgLmUnitName, cgLmUnitAddress, cgLmUnitTelephone, cgLmUnitFacsimile, cgLmHomeAddress, cgLmHomeTelephone,
                cgLmHandset, cgLmEmail, cgLmOicq, cgLmMsn, cgLmRemark);
        }

        /// <summary>
        /// 根据用户的单位关键字查找用户联系人信息
        /// </summary>
        /// <param name="lmUnitName"></param>
        /// <returns></returns>
        public List<PublicCommunicationGroupLinkMantb> findByLinkManUnitName(string lmUnitName)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.findByLinkManUnitName(lmUnitName);
        }

        /// <summary>
        /// 根据联系人生日查询当前用户的联系人
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public List<PublicCommunicationGroupLinkMantb> findByBirthday(string startDate, string endDate)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.findByBirthday(startDate, endDate);
        }

        /// <summary>
        /// 根据联系人姓名查找当前用户的联系人信息
        /// </summary>
        /// <param name="lmName"></param>
        /// <returns></returns>
        public List<PublicCommunicationGroupLinkMantb> findByLinkManName(string lmName)
        {
            PublicCommunicationGroupLinkMantbDAO pcgLmDAO = new PublicCommunicationGroupLinkMantbDAO();
            return pcgLmDAO.findByLinkManName(lmName);
        }
    }
}
